<?php 
include("function.php"); 
check_login();
if(isset($_GET["folder_id"])){
		if(!empty($_GET["folder_id"])){	
		$sql="select * from doc_folder where id =".$_GET["folder_id"]." limit 1";
		mysql_query("set names utf8");
		$result_folder=mysql_query($sql) or die (mysql_error());
		while($rs_folder=mysql_fetch_array($result_folder)){			
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加新文件</title>
<style type="text/css">
.input_version{
	width:65px;
	color:#666;
	border:none;
	}
.readonly{
	color:#666;
	}	
.red{
	color:#F00;
	}
#up_err_msg{
	background:#F00;
	color:#FFF;
	}	
</style>

</head>

<body onload="startTime(); make_ver();">
<div style="font:24px bold;">在此文件版本上新建立后续版本文档-<a href="#" style="font:12px;">帮助</a></div>
<fieldset style="background:#D9E2FF;  padding:10px;">
<legend>
在文件夹<?php echo " <a href='folder_detail.php?id=".$rs_folder["id"]."'>".$rs_folder["folder_name"]."</a> ";?>中创建初始版本文件 <font size="-1">您可以添加WORD、EXCEL、TXT等文件,支持文件列表<a href="#" onclick="view_doc_type();">见此</a></font>
</legend> 



<br />

<form action="doc_add_init_code.php" method="post" onsubmit="return check_form();">
<label>文档名称：
  <input name="doc_name" type="text" class="readonly" id="doc_name" />
  <input name="folder_id" id="folder_id" type="hidden" value="<?php echo $rs_folder["id"];?>" />
  <input name="folder_name" id="folder_name" type="hidden" value="<?php echo $rs_folder["folder_name"];?>" />
</label>
<span class="red">*</span>-<a href="#" style="font:12px;">帮助</a><br />
<label>版本：  
<input name="doc_ver_full" class="readonly" id="doc_ver_full"  style="border:none; background:none;"  value="" readonly="readonly" />
<span class="red">*</span>(自动)-<a href="#" style="font:12px;">帮助</a><br />
<table width="" border="0" cellpadding="0" cellspacing="1" style="font-size:12px;" bgcolor="#95C5F0">
<tr>
<td width="70" bgcolor="#95C5F0"><a href="#">v</a></td>  
<td width="70" bgcolor="#95C5F0"><a href="#">大版本号</a></td>  
<td width="70" bgcolor="#95C5F0"><a href="#">小版本号</a></td>  
<td width="70" bgcolor="#95C5F0"><a href="#">编译次数</a></td>  
<td width="80" bgcolor="#95C5F0"><a href="#">最后修订</a>(可改)</td>  
<td width="70" bgcolor="#95C5F0"><a href="#">备注</a>(可改)</td>
<td width="54" height="20" bgcolor="#95C5F0"><a href="#" style="font:12px;">帮助</a></td>   
</tr>
<tr>
  <td bgcolor="#FFFFFF"><input name="ver_1" id="ver_1" type="text" class="input_version" value="v" readonly="readonly"  /></td>
  <td bgcolor="#FFFFFF"><input name="ver_2" id="ver_2" type="text" class="input_version" value="1" readonly="readonly"  />
<strong>.</strong></td>
  <td bgcolor="#FFFFFF"><input name="ver_3" id="ver_3" type="text" class="input_version" value="0" readonly="readonly"  />
<strong>.</strong></td>
  <td bgcolor="#FFFFFF"><input name="ver_4" id="ver_4" type="text" class="input_version" value="0" readonly="readonly"  />
</td>
  <td bgcolor="#FFFFFF"><input name="ver_5" id="ver_5" type="text" class="input_version" onchange="make_ver();" value=".<?php echo date("Ymd");?>"/></td>
  <td bgcolor="#FFFFFF"><input name="ver_6" id="ver_6" type="text" class="input_version" value=""  onchange="make_ver();"/></td>
  <td bgcolor="#FFFFFF"> (自动)</td>
</tr>
</table>

<label>添加人员：
  <input name="doc_owner" type="text" class="readonly" id="doc_owner" value="<?php echo $_SESSION["user_name"];?>" readonly="readonly" />
</label>
<span class="red">*</span>(自动)-<a href="#" style="font:12px;">帮助</a><br />
<label>添加时间：
  <input name="doc_add_time" type="text" class="readonly" id="doc_add_time" value="" />
</label>
<span class="red">*</span>(自动)-<a href="#" style="font:12px;">帮助</a><br />
<label>内容简介：</label><br />
  <textarea name="doc_content" cols="45" rows="5" id="doc_content"></textarea>
*建议填写-<a href="#" style="font:12px;">帮助</a>

<br />

<div style="height:10px; border-bottom:#333 1px solid; width:98%; "></div>

<br />在这里上传文件：<br />

<iframe src="upload_class.php?action=" frameborder="0px" width="250" height="20" scrolling="no"></iframe>
-<a href="#" style="font:12px;">帮助</a><br />
<div id="up_err_msg"></div>


<fieldset id="upfile_info_box" style="display:none; font-size:12px;"><legend id="upfile_info_sub_box">文件信息</legend>

文件路径
<input name="upfile_dir_name" type="text" class="readonly" id="upfile_dir_name" value="" size="35" readonly="readonly" />
<!--<a href="#" id="a" onclick="window.open(document.getElementById('upfile_dir_name').value,'test')">aaa</a> -->
<?php 
//$word = new COM("word.application");

?>
<br />
文件指纹
<input name="upfile_sha1" type="text" class="readonly" id="upfile_sha1" value="" size="50" readonly="readonly" />
<br />
文件名&nbsp;&nbsp;&nbsp;&nbsp;
<input name="upfile_name" type="text" class="readonly" id="upfile_name" value="" size="50" readonly="readonly" />
<br />
文件大小&nbsp;&nbsp;&nbsp;&nbsp;
<input name="upfile_size" type="text" class="readonly" id="upfile_size" value="" size="50" readonly="readonly" />
<br />
文件类型&nbsp;&nbsp;&nbsp;&nbsp;
<input name="upfile_extname" type="text" class="readonly" id="upfile_extname" value="" size="50" readonly="readonly" onchange="echo_file_type(this);" /> <span id="upfile_type"></span>
<br />
dev
<input name="upfile_info_13" type="text" class="readonly" id="upfile_info_13" value="" size="50" readonly="readonly" />

<br />
ino
<input name="upfile_info_14" type="text" class="readonly" id="upfile_info_14" value="" size="50" readonly="readonly" />

<br />
mode
<input name="upfile_info_15" type="text" class="readonly" id="upfile_info_15" value="" size="50" readonly="readonly" />

<br />
nlink
<input name="upfile_info_16" type="text" class="readonly" id="upfile_info_16" value="" size="50" readonly="readonly" />

<br />
uid
<input name="upfile_info_17" type="text" class="readonly" id="upfile_info_17" value="" size="50" readonly="readonly" />

<br />
gid

<input name="upfile_info_18" type="text" class="readonly" id="upfile_info_18" value="" size="50" readonly="readonly" />
<br />
rdev
<input name="upfile_info_19" type="text" class="readonly" id="upfile_info_19" value="" size="50" readonly="readonly" />

<br />
size
<input name="upfile_info_20" type="text" class="readonly" id="upfile_info_20" value="" size="50" readonly="readonly" />KB

<br />
atime
<input name="upfile_info_21" type="text" class="readonly" id="upfile_info_21" value="" size="50" readonly="readonly" />
访问时间<br />
mtime
<input name="upfile_info_22" type="text" class="readonly" id="upfile_info_22" value="" size="50" readonly="readonly" />

修改时间<br />
ctime
<input name="upfile_info_23" type="text" class="readonly" id="upfile_info_23" value="" size="50" readonly="readonly" />
创建时间<br />
blksize
<input name="upfile_info_24" type="text" class="readonly" id="upfile_info_24" value="" size="50" readonly="readonly" />
<br />
blocks
<input name="upfile_info_25" type="text" class="readonly" id="upfile_info_25" value="" size="50" readonly="readonly" />
<br />
<br />
</fieldset>
<input name="post_id" type="hidden" id="post_id" value="true" size="50"/>
<input name="" type="submit" value="确定添加" />
</form>
</fieldset>












file_upload_ver1.0.8
<script type="text/javascript">
function make_ver(){
document.getElementById("doc_ver_full").value=document.getElementById("ver_1").value+document.getElementById("ver_2").value+"."+document.getElementById("ver_3").value+"."+document.getElementById("ver_4").value+document.getElementById("ver_5").value+document.getElementById("ver_6").value;
document.getElementById('doc_ver_full').style.width=document.getElementById('doc_ver_full').value.length*8+'px';
}

function startTime()
{
var today=new Date()
var y=today.getFullYear()
var m=today.getMonth()+1
var d=today.getDate()
var h=today.getHours()
var i=today.getMinutes()
var s=today.getSeconds()
// add a zero in front of numbers<10
i=checkTime(i)
s=checkTime(s)
document.getElementById('doc_add_time').value=y+"-"+m+"-"+d+" "+h+":"+i+":"+s
t=setTimeout('startTime()',500)
}

function checkTime(i)
{
if (i<10) 
  {i="0" + i}
  return i
}

function view_doc_type(){
	alert("'jpg','jpeg','gif','bmp','png','xls','doc','vsd','dot','ppt','txt','rtf','pdf','zip','ppt','pps','mp3','wma','wmv','mp4','rm','tiff','wmv','exe','rar','dll'");
	}
	
function echo_file_type(obj){
	if(obj.value=="rar"){
		document.getElementById("upfile_type").innerHTML="压缩包";
		}
	if(obj.value=="jpg"){
		document.getElementById("upfile_type").innerHTML="图片";
		}
		
		
	//switch(obj.value){
		//case "rar":document.getElementById("upfile_type").innerHTML="压缩包";
	
	}
	
function check_form(){
	if(document.getElementById("upfile_dir_name").value.length<=0){
		if(confirm("您未上传文件，请上传文件！")){
			//window..location="a.php";
			
			return false;
			}
			return false;		
	}
	
	if(document.getElementById("doc_name").value.length<=2){
		alert("文档名称未填写或长度小于2，请重新填写！");
		document.getElementById("doc_name").focus();
		return false;		
		}
	}

</script>
</body>
</html>
<?php
}
}
	}else{
		alert_error("未能获取所属文件信息。此错误为高级错误，请联系林聪处理","00007");
		}
?>